<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="set">创建</button>
    <button class="get">获取</button>
</body>
<script>

    // 如何创建cookie?
    // 1. cookie的存取都依赖于document.cookie
    // 2. cookie是以键值对形成存在的(字符串) => 存的时候是一条一条存储的,取的时候一次性取出所有的cookie(以"; "分隔)


    var set = document.getElementsByClassName("set")[0];
    var get = document.getElementsByClassName("get")[0];

    set.onclick = function () {
        document.cookie = "user=a123123";
        document.cookie = "pwd=123123";
        document.cookie = "phone=17386141517";
        document.cookie = "email=1272071495@qq.com";
    }

    get.onclick = function () {
        console.log(document.cookie);
    }



</script>

</html>